package net.raebiger.spreadsheetcat.util;

import net.raebiger.spreadsheetcat.R;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class DialogUtil {
	private final static DialogUtil onlyInstance = new DialogUtil();

	private DialogUtil() {
		// empty by design
	}

	public static DialogUtil getInstance() {
		return onlyInstance;
	}

	public void showDialog(String msg, Context context) {
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setMessage(msg);
		builder.setCancelable(false);
		builder.setPositiveButton(context.getString(R.string.OK),
				new DialogInterface.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialog, int which) {
						dialog.dismiss();
					}
				});
		builder.create().show();
	}

	public void showDialog(int stringResourceId, Context context) {
		showDialog(context.getString(stringResourceId), context);
	}
}
